package com.ruoyi.web.controller.system;

import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.service.ISysDashboardService;

/**
 * 仪表盘数据 控制器
 * 
 * @author ruoyi
 */
@RestController
@RequestMapping("/system/dashboard")
public class SysDashboardController extends BaseController
{
    @Autowired
    private ISysDashboardService dashboardService;

    /**
     * 获取数据大屏统计数据
     */
    @PreAuthorize("@ss.hasPermi('system:dashboard:list')")
    @GetMapping("/datascreen")
    public AjaxResult getDataScreenStats()
    {
        Map<String, Object> statsData = dashboardService.getDataScreenStats();
        return AjaxResult.success(statsData);
    }

    /**
     * 获取数据大屏实时数据
     */
    @PreAuthorize("@ss.hasPermi('system:dashboard:list')")
    @GetMapping("/realtime")
    public AjaxResult getDataScreenRealtime()
    {
        Map<String, Object> realtimeData = dashboardService.getDataScreenRealtime();
        return AjaxResult.success(realtimeData);
    }
} 